/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "require_patch")
@NamedQueries({
    @NamedQuery(name = "RequirePatch.findAll", query = "SELECT r FROM RequirePatch r"),
    @NamedQuery(name = "RequirePatch.findByRpId", query = "SELECT r FROM RequirePatch r WHERE r.rpId = :rpId"),
    @NamedQuery(name = "RequirePatch.findByRpName", query = "SELECT r FROM RequirePatch r WHERE r.rpName = :rpName"),
    @NamedQuery(name = "RequirePatch.findByRpDescrip", query = "SELECT r FROM RequirePatch r WHERE r.rpDescrip = :rpDescrip")})
public class RequirePatch implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "rp_id")
    private Integer rpId;
    @Basic(optional = false)
    @Column(name = "rp_name")
    private String rpName;
    @Column(name = "rp_descrip")
    private String rpDescrip;
    @JoinColumn(name = "p_id", referencedColumnName = "p_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Project project;

    public RequirePatch() {
    }

    public RequirePatch(Integer rpId) {
        this.rpId = rpId;
    }

    public RequirePatch(Integer rpId, String rpName) {
        this.rpId = rpId;
        this.rpName = rpName;
    }

    public Integer getRpId() {
        return rpId;
    }

    public void setRpId(Integer rpId) {
        this.rpId = rpId;
    }

    public String getRpName() {
        return rpName;
    }

    public void setRpName(String rpName) {
        this.rpName = rpName;
    }

    public String getRpDescrip() {
        return rpDescrip;
    }

    public void setRpDescrip(String rpDescrip) {
        this.rpDescrip = rpDescrip;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (rpId != null ? rpId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RequirePatch)) {
            return false;
        }
        RequirePatch other = (RequirePatch) object;
        if ((this.rpId == null && other.rpId != null) || (this.rpId != null && !this.rpId.equals(other.rpId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.RequirePatch[rpId=" + rpId + "]";
    }

}
